﻿using Practice.PH4_2104A.DAL;
using Practice.PH4_2104A.IRepository;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Practice.PH4_2104A.Repository
{
    /// <summary>
    /// 工作单元的实现
    /// </summary>
    public class UnitOfWork : IUnitOfWork
    {
        MyDbContext _context;

        public UnitOfWork(MyDbContext context)
        {
            _context = context;
        }

        //获取上下文对象
        public MyDbContext GetDbContext()
        {
            return _context;
        }

        //提交数据
        public int SaveChanges()
        {
            return _context.SaveChanges();
        }
    }
}
